// 权限相关接口
import request from '@/utils/request'

// 获取所有权限数据

/**
 * 获取权限点列表
 * @returns {promise}
 */
export const getPermissionList = () => {
  return request({
    url: '/sys/permission',
    method: 'get'
  })
}

/**
 * 添加权限点
 * @returns {promise}
 */
export const addPermission = (data) => {
  return request({
    url: '/sys/permission',
    method: 'post',
    data
  })
}

/**
 * 根据权限获取详情
 * @returns {promise}
 */
export const getPermissionById = (id) => {
  return request({
    url: `/sys/permission/${id}`,
    method: 'get'
  })
}

/**
 * 更新权限
 * @returns {promise}
 */
export const updatePermission = (data) => {
  return request({
    url: `/sys/permission/${data.id}`,
    method: 'put',
    data
  })
}

/**
 * 删除权限
 * @returns {promise}
 */
export const delPermission = (id) => {
  return request({
    url: `/sys/permission/${id}`,
    method: 'delete'
  })
}
